package jinyilw.swing.rlaf.ui;

import java.awt.Component;
import java.awt.event.FocusEvent;
import java.awt.event.FocusListener;

/**
 * @author Jinyi
 */
public class RFocusManager implements FocusListener
{
	public boolean isFocus;
	Component focusCom, paintCom;

	public RFocusManager(Component c)
	{
		paintCom = focusCom = c;
		c.addFocusListener(this);
	}

	public void setPaintComponent(Component c)
	{
		paintCom = c;
	}

	public boolean isEnable()
	{
		return focusCom.isEnabled();
	}

	@Override
	public void focusLost(FocusEvent e)
	{
		isFocus = false;
		paintCom.repaint();
	}

	@Override
	public void focusGained(FocusEvent e)
	{
		isFocus = true;
		paintCom.repaint();
	}
}
